summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-08 14:59:15 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-08 14:59:15 +0200
commit791bf732fd490700748f798c617ecac1af152cd4 (patch)
tree2ca9be2cebeeb560b60c108959e805126d3173ed /Tools
parentPickups have an initial health of 5 (diff)
downloadcuberite-791bf732fd490700748f798c617ecac1af152cd4.tar
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.gz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.bz2
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.lz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.xz
cuberite-791bf732fd490700748f798c617ecac1af152cd4.tar.zst
cuberite-791bf732fd490700748f798c617ecac1af152cd4.zip
Diffstat (limited to 'Tools')
-rw-r--r--Tools/ProtoProxy/Connection.cpp68
-rw-r--r--Tools/ProtoProxy/Connection.h2
2 files changed, 70 insertions, 0 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index f23eecbe8..a3d3191fc 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -12,6 +12,16 @@
+#ifdef _DEBUG
+ #define DebugSleep Sleep
+#else
+ #define DebugSleep(X)
+#endif // else _DEBUG
+
+
+
+
+
#define HANDLE_CLIENT_PACKET_READ(Proc, Type, Var) \
Type Var; \
{ \
@@ -47,6 +57,7 @@
{ \
SERVERENCRYPTSEND(ToServer.data(), ToServer.size()); \
} \
+ DebugSleep(50); \
}
#define COPY_TO_CLIENT() \
@@ -61,6 +72,7 @@
{ \
CLIENTENCRYPTSEND(ToClient.data(), ToClient.size()); \
} \
+ DebugSleep(50); \
}
#define HANDLE_CLIENT_READ(Proc) \
@@ -159,6 +171,7 @@ enum
PACKET_INCREMENT_STATISTIC = 0xc8,
PACKET_LOCALE_AND_VIEW = 0xcc,
PACKET_CLIENT_STATUSES = 0xcd,
+ PACKET_PLUGIN_MESSAGE = 0xfa,
PACKET_ENCRYPTION_KEY_RESPONSE = 0xfc,
PACKET_ENCRYPTION_KEY_REQUEST = 0xfd,
PACKET_PING = 0xfe,
@@ -211,6 +224,7 @@ cConnection::cConnection(SOCKET a_ClientSocket, cServer & a_Server) :
fnam.append(".log");
m_LogFile = fopen(fnam.c_str(), "w");
Log("Log file created");
+ printf("Connection is logged to file \"%s\"\n", fnam.c_str());
}
@@ -537,6 +551,7 @@ bool cConnection::DecodeClientsPackets(const char * a_Data, int a_Size)
case PACKET_PLAYER_ON_GROUND: HANDLE_CLIENT_READ(HandleClientPlayerOnGround); break;
case PACKET_PLAYER_POSITION: HANDLE_CLIENT_READ(HandleClientPlayerPosition); break;
case PACKET_PLAYER_POSITION_LOOK: HANDLE_CLIENT_READ(HandleClientPlayerPositionLook); break;
+ case PACKET_PLUGIN_MESSAGE: HANDLE_CLIENT_READ(HandleClientPluginMessage); break;
case PACKET_SLOT_SELECT: HANDLE_CLIENT_READ(HandleClientSlotSelect); break;
case PACKET_UPDATE_SIGN: HANDLE_CLIENT_READ(HandleClientUpdateSign); break;
case PACKET_USE_ENTITY: HANDLE_CLIENT_READ(HandleClientUseEntity); break;
@@ -636,6 +651,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size)
case PACKET_PLAYER_ANIMATION: HANDLE_SERVER_READ(HandleServerPlayerAnimation); break;
case PACKET_PLAYER_LIST_ITEM: HANDLE_SERVER_READ(HandleServerPlayerListItem); break;
case PACKET_PLAYER_POSITION_LOOK: HANDLE_SERVER_READ(HandleServerPlayerPositionLook); break;
+ case PACKET_PLUGIN_MESSAGE: HANDLE_SERVER_READ(HandleServerPluginMessage); break;
case PACKET_SET_EXPERIENCE: HANDLE_SERVER_READ(HandleServerSetExperience); break;
case PACKET_SET_SLOT: HANDLE_SERVER_READ(HandleServerSetSlot); break;
case PACKET_SLOT_SELECT: HANDLE_SERVER_READ(HandleServerSlotSelect); break;
@@ -997,6 +1013,26 @@ bool cConnection::HandleClientPlayerPositionLook(void)
+bool cConnection::HandleClientPluginMessage(void)
+{
+ HANDLE_CLIENT_PACKET_READ(ReadBEUTF16String16, AString, ChannelName);
+ HANDLE_CLIENT_PACKET_READ(ReadBEShort, short, Length);
+ AString Data;
+ if (!m_ClientBuffer.ReadString(Data, Length))
+ {
+ return false;
+ }
+ Log("Received a PACKET_PLUGIN_MESSAGE from the client");
+ Log(" ChannelName = \"%s\"", ChannelName.c_str());
+ DataLog(Data.data(), Length, " Data: %d bytes", Length);
+ COPY_TO_SERVER();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleClientSlotSelect(void)
{
HANDLE_CLIENT_PACKET_READ(ReadBEShort, short, SlotNum);
@@ -1351,12 +1387,24 @@ bool cConnection::HandleServerEntityProperties(void)
Log("Received a PACKET_ENTITY_PROPERTIES from the server:");
Log(" EntityID = %d", EntityID);
Log(" Count = %d", Count);
+
for (int i = 0; i < Count; i++)
{
HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Key);
HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, Value);
Log(" \"%s\" = %f", Key.c_str(), Value);
} // for i
+
+ HANDLE_SERVER_PACKET_READ(ReadBEShort, short, ListLength);
+ Log(" ListLength = %d", ListLength);
+ for (int i = 0; i < ListLength; i++)
+ {
+ HANDLE_SERVER_PACKET_READ(ReadBEInt64, Int64, UUIDHi);
+ HANDLE_SERVER_PACKET_READ(ReadBEInt64, Int64, UUIDLo);
+ HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, DblVal);
+ HANDLE_SERVER_PACKET_READ(ReadByte, Byte, ByteVal);
+ Log(" [%d] = {0x%08llx%08llx, %f, %i}", i, UUIDHi, UUIDLo, DblVal, ByteVal);
+ } // for i
COPY_TO_CLIENT();
return true;
}
@@ -1741,6 +1789,26 @@ bool cConnection::HandleServerPlayerPositionLook(void)
+bool cConnection::HandleServerPluginMessage(void)
+{
+ HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, ChannelName);
+ HANDLE_SERVER_PACKET_READ(ReadBEShort, short, Length);
+ AString Data;
+ if (!m_ServerBuffer.ReadString(Data, Length))
+ {
+ return false;
+ }
+ Log("Received a PACKET_PLUGIN_MESSAGE from the server");
+ Log(" ChannelName = \"%s\"", ChannelName.c_str());
+ DataLog(Data.data(), Length, " Data: %d bytes", Length);
+ COPY_TO_SERVER();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleServerSetExperience(void)
{
HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, ExperienceBar);
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index 013471302..7f3a6f8bb 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -122,6 +122,7 @@ protected:
bool HandleClientPlayerOnGround(void);
bool HandleClientPlayerPosition(void);
bool HandleClientPlayerPositionLook(void);
+ bool HandleClientPluginMessage(void);
bool HandleClientSlotSelect(void);
bool HandleClientUpdateSign(void);
bool HandleClientUseEntity(void);
@@ -162,6 +163,7 @@ protected:
bool HandleServerPlayerAnimation(void);
bool HandleServerPlayerListItem(void);
bool HandleServerPlayerPositionLook(void);
+ bool HandleServerPluginMessage(void);
bool HandleServerSetExperience(void);
bool HandleServerSetSlot(void);
bool HandleServerSlotSelect(void);